<template>
	<view>
		<uni-search-bar @confirm="search" :focus="true" v-model="keyword"   
						 clearButton="none" cancelButton="none">
					</uni-search-bar>
		<uni-card v-for="category in categoryList" @click="toInfoPage(category)" >
			<uni-section :title="category.classLabel" type="line">
				
			</uni-section>
			<view class="desc">
				{{category.features}}
			</view>
		</uni-card>
		
		
	</view>
</template>

<script>
	import Item from '@/component/item.vue'
	import {searchCategory} from '@/network/api/classification.js'
	export default {
		components:{
			Item
		},
		data() {
			return {
				categoryList:[],
				keyword:""
			}
		},
		onLoad(option) {
			//发送请求，获取搜索到的结果
			const keyword = option.keyword;
			this.keyword = keyword
			searchCategory(keyword).then(result=>{
				this.categoryList = result.data
			})
		},
		methods: {
			toInfoPage(category){
				uni.redirectTo({
					url:"/pages/classinfo/classinfo?classId="+category.classId
				})
			}
		}
	}
</script>

<style lang="scss" scoped>

.desc{
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
}
</style>
